/**
 * Created by tomryan on 2018/02/01.
 */
$(function () {
    $("#toLogin").on("click", function (e) {
        var userName = $("#userName").val();
        var passWord = $("#passWord").val();
        $.ajax({
            url: '/login',
            type: 'POST',
            data: {userName: userName, passWord: passWord},
            success: function (data) {
                if (data == 'T') {
                    location.href = 'index';
                }
                else {
                    alert('error');
                }
            },
            error: function (data) {

            }
        });
    });
    $(document).keypress(function (e) {
        if (e.keyCode == 13)
        {
            $("#toLogin").click();
        }
    });
});
